<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ page language="java" import="com.server.web.JsVersionUtil"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" id="viewport" name="viewport">
<meta name="viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"/>
<title>北京市人民政府外事办公室领事保护教育服务平台</title>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet"
	href="<c:url value='/share/bootstrap.min.css'></c:url>">
<link rel="stylesheet"
	href="<c:url value='/share/AllStyle.css'></c:url>">
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="<c:url value='/js/jquery.min.js'></c:url>"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="<c:url value='/js/bootstrap.min.js'></c:url>"></script>
<script src="<c:url value='/js/all.js'></c:url>"></script>
<%-- <script src="<c:url value='/js/rqfCommon/sockjs-0.3.min.js'></c:url>"></script> --%>
<script src="http://cdn.sockjs.org/sockjs-0.3.min.js"></script>
<script src="<c:url value='/js/jquery.ui.widget.js'></c:url>"></script>
<script src="<c:url value='/js/jquery.fileupload.js'></c:url>"></script>
<script src="<c:url value='/js/rqfCommon/stomp.js'></c:url>"></script>
<script src="<c:url value='/js/serverCommonJs.js'></c:url>"></script>
<script src="<c:url value='/js/rqfCommon/rqfCommon.js'></c:url>"></script>
	<style type="text/css">
		html,body{
			    overflow-x: hidden;
		}
		p,i,ul,li,html,body,span,table{
			margin:0;
			padding: 0;

		}
		html,body {
			height: 100%;
			background:#fff;
		}
		.info-box {
			
		   
		    margin-top: 40px;
		    margin-left: calc(50% - 595px);
		    /*box-shadow: 0 0 5px gray;*/
		    padding: 0px 50px;
		    background: #fff;
		}

		
		.home_header_right_login>a:nth-child(1) {
			background-color: #1e519f;
			color: #fff;
		}			
		.info-title {
			padding-top: 20px;
			padding-bottom: 20px;
			font-size:18px;
			height: 50px;
			line-height: 50px;

		}
		.info_panel{
			color: #000;
			border-bottom: 3px solid #295c96;
			margin-left: 33.3%;
			font-size: 21px;
		}
		.grayline{
			height: 53px;
			border-bottom: 3px solid #e2e2e2;
		}
		.info-content {
			width: 100%;
			clear: both;
			margin-left: 5%;
			margin-right: 5%;
			margin-top:50px;
			color: #535353;
		}
		.basic_info_title,.trainning_needs_title{
			width: 200px;
			padding-left: 30px;
			border-left: 5px solid #1e519f;
			font-size: 19px;
			color: #1e519f;
			clear: both;
		}
		.input_group{
			margin: 30px 0px;
			font-size: 14px;
			
		}
		.input_group div:nth-child(1){
			display: inline-block;
			width: 120px;
		}
		.input_group p{
			float: right;
			height: 15px;
		}
		.input_group p i{
			color: red;
			margin-right: 5px;
		}
		.input_group input,.input_group select{
			height: 30px;
			width: 250px;
			line-height: 30px;
    		padding: 0px 0px 0 2px;
    		white-space: nowrap;
    		overflow: hidden;
    		text-overflow: ellipsis;
		}
		.twoclass{
			
			width: 120px !important;
			
		}
		.input_group ul{
			clear: both;
			display: inline-block;
		}
		.input_group ul>li{
			display: inline-block;
			margin-right: 20px;
		}
		.input_group ul>li input{
			width: 15px;
			height: 15px;
			margin-right: 7px;
		}
		.basic_info_content_left_pannel{
			width: 50%;
			float: left;
		}
		.basic_info_content_right_pannel{
			width: 50%;
			float: right;
		}		
		.file {
    position: relative;
    display: inline-block;
    background: #1e519f;
    /*border: 1px solid #99D3F5;*/
    border-radius: 4px;
    /* padding: 4px 12px; */
    overflow: hidden;
    color: #1E88C7;
    text-decoration: none;
    text-indent: 0;
    line-height: 20px;
    cursor: pointer !important;
}
.file input {
	    position: absolute;
    font-size: 100px;
    right: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
}
.file:hover {
background: #ccc;
    text-decoration: none;
}

		#change_head_btn{
	width: 75px;
    height: 30px;
    color: white;
    text-align: center;
    line-height: 30px;
    margin-left: calc(50% - 70px);
    margin-top: 27px;
		}
		#headimg{
			margin-left:calc(50% - 110px);
			width:150px;
			height:150px;
			/* border:1px solid #ccc; */
			background-size: 100%;
		}
		.inlineDisplay{
			display: inline-block;	
		}
		.btn {
			padding: 8px 24px !important;
			font-size: 16px !important;
			color: white;
			background: #1e519f !important;
			width: 300px;
			margin-bottom: 60px;
			margin-left: calc(50% - 150px);
			margin-top: 20px;
			border:none;
		}
		.header-tool-news .header-tc-content {
    width: 302px;
    padding: 0 26px;
    line-height: 34px;
    right: -69px;
    text-align: center;
}
.header-tc-content {
	display: none;
    position: absolute;
    border: 1px solid #ccc;
    width: 370px;
    left: -183px;
    top: 40px;
    background-color: #fff;
    text-align: left;
    /* display: none; */
    z-index: 2;
    color: #4b4b4b;
    font-size: 12px;
    height: auto!important;
    min-height: 32px;
    height: 32px;
    box-shadow: 0 2px 5px #d5d5d5;
}

.header-tool-news .header-tc-content .header-tc-ct-bg {
    right: 76px;
}
.header-tc-ct-bg {
    position: absolute;
    top: -15px;
    left: 50%;
    width: 0;
    height: 0;
    border: 7px solid #ccc;
    border-color: transparent transparent #ccc;
    z-index: 5;
}

.header-tc-ct-bg:before {
    content: "";
    position: absolute;
    top: -7px;
    right: -8px;
    width: 0;
    height: 0;
    border: 8px solid #fff;
    border-color: transparent transparent #fff;
    z-index: 3;
}
.news-title {
    line-height: 42px;
    overflow: hidden;
    border-bottom: 1px solid #2459aa;
    margin: 0 18px;
}
.news-list {
    margin: 0;
    padding: 0;
    max-height: 332px;
    overflow-y: auto;
    margin: 0 18px;
    position: relative;
}
.news-bottom {
    line-height: 42px;
    text-align: center;
    border-top: 1px solid #e0e6f1;
    background: #f6f6f6;
    color: rgb(180, 180, 180);
}
.news-title .news-title-ctx {
    color: #2459aa;
    font-size: 14px;
    float: left;
}
.news-bottom .news-more {
    color: #b4b4b4;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}
.news-item{
	line-height: 60px;
	border-bottom: 1px solid #e0e6f1;
}
.news-item:last-child {
    border-bottom: none;
}
.news-ctx-link{
  color: rgb(124, 124, 125);
  font-size: 14px;
  overflow: hidden;
  width: 300px;
  padding: 0 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  float: left;
}
.news-ctx{
	position: relative;
    overflow: hidden;
}
.wh_Home_news{
	float: left;
	padding-bottom: 10px;
}



/* 9.9wzw */
.home_header {
    width: 100%;
    background: #fff;
    color: #1E539F;}

.Interface_center {
    width: 1190px;
    padding: 0px;
    margin: 0 auto;
    max-width: 1190px;
}
.home_header_left {
    font-size: 14px;
}
.home_header_left {
    cursor: pointer;
    float: left;

    line-height: 42px;
}
.dropdown-toggle {
    display: inline-block;
    padding: 3px 12px;
    margin-bottom: 0;
    font-weight: normal;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background-image: none;
    border-radius: 4px;
    color: #fff;
    border: none;
    font-size: 14px;
    margin-top: 6px;
}
#touxiang_true {
    margin-right: 10px;
    float: left;
    width: 30px;
    height: 30px;
    border-radius: 100%;
    margin-top: 3px;
    display: block;
    line-height: 60px;
    color: #787d82;
    text-align: center;
    -webkit-transition: background-color 0.2s;
    -moz-transition: background-color 0.2s;
    transition: background-color 0.2s;
}
a#dropdownMenu1 {
    padding: 3px 12px;
}
.vertical {
    margin: 0 8px;
    background: #dae1e6;
    display: inline-block;
    width: 1px;
    height: 24px;
    vertical-align: middle;
}
	</style>
</head>
<body>

	<div class="home_header">
		<div class="Interface_center row" style="width: auto;">
			<div class="col-xs-6" style="height: 42px;position: relative;overflow: hidden;">
				<div class="home_header_left">
					<span><img
						src="<c:url value='/share/images/book.png'></c:url>">北京市人民政府外事办公室领事保护教育服务平台</span>
				</div>
			</div>
			<div class="col-xs-6" style="height: 42px;">
				<div class="home_header_right"
					style="position: relative;height: 42px;">
					<c:if test="${not empty  userName}">
						<div class="wh_Home_news">
							<div class="header-tc-content">
			                    <span class="header-tc-ct-bg"></span>
			                    <div class="news-header">
			                    	<div class="news-title clr">
			                    		<span class="news-title-ctx">消息</span>
			                    	</div>
			                    	<ul class="news-list" id="news-list">
			                    	</ul>
			                    	<div class="news-bottom clearfix">
			                    		<a class="news-more" href="javascript:;" onclick="_naviClick(7)">查看所有消息>></a>
			                    	</div>
			                    </div>
			                </div>
							<a id="remindId" href="javascript:;"
								style="display: block; width: 18px;text-align: center; top: 5px; left: 20px; background: #e93a44; position: absolute; margin: 0; border: 0; border-radius: 100%; color: #fff; padding: 0px 4px; font-size: 12px;"></a>
							<img src="<c:url value='/share/images/black1.png'></c:url>"
								id="touxiang_lingdang"
								style="width: 18.85px; height: 24px; margin-top: 7px; cursor: pointer;">
							<span class="vertical" style="margin: 0 20px; margin-top: 10px;"></span>
						</div>
						<div class="home_login_true_2" style="float: right; margin-top: 3px;">
							<c:if test="${empty url}">
							<img src="<c:url value='/share/images/head.jpg'/>" id="touxiang_true"/>
							</c:if>
							<c:if test="${not empty url}">
							<img src="${fileServer}${url}" id="touxiang_true"/>
							</c:if>
							<div class="home_login_true_2" style="float: right;">
								<div class="dropdown">
									<a class="btn-default dropdown-toggle" id="dropdownMenu1"
									style="color: #295c96;border: none; font-size: 16px; margin-top: 6px;">
										${userName} <span class="caret" style="margin-left: 10px;"></span>
									</a>
									<ul class="dropdown-menu">
										<li><a href="<c:url value='/login/perfectInfo'></c:url>"
											id="login_perfect">个人资料</a></li>
										<li><a href="<c:url value='/login/logout'></c:url>"
											id="login_remove">退出</a></li>
									</ul>
								</div>
							</div>
					</c:if>
					<c:if test="${empty  userName}">
						<a href="<c:url value='/login'></c:url>">登录</a>
						<a href="<c:url value='/login/register'></c:url>">注册</a>
					</c:if>
				</div>
			</div>
		</div>
	</div>
	<div class="home_header_1">
		<div class="Interface_center" style="width: auto;">
			<ul class="home_header-nav menu-nav clearfix">
				<li><img src="<c:url value='/share/images/12_07.png'></c:url>"></li>
				<li id="li1"><a class="plan-event track-event"
					href="<c:url value="/?tabId=1" />">课程</a></li>
				<li><img src="<c:url value='/share/images/12_07.png'></c:url>"></li>
				<li id="li2"><a class="features-event track-event" href="<c:url value="/?tabId=2" />">案例</a>
				</li>
				<li><img src="<c:url value='/share/images/12_07.png'></c:url>"></li>
				<li id="li3"><a class="plan-event track-event" href="<c:url value="/?tabId=3" />">考试</a>
				</li>
				<li><img src="<c:url value='/share/images/12_07.png'></c:url>"></li>
				<li id="li4"><a class="templates-event track-event"
					href="javascript:naviClick(4)">涉外安全资料</a></li>
				<li><img src="<c:url value='/share/images/12_07.png'></c:url>"></li>
				<%-- <li id="li5"><a class="templates-event track-event"
					href="javascript:naviClick(5)">咨询答疑</a></li>
				<li><img src="<c:url value='/share/images/12_07.png'></c:url>"></li> --%>
			</ul>
		</div>
	</div>

	<div class="home_header_2" style="width: 1190px;margin:0 auto;">
		<div class="info-box">
			<div class="info-content">
				<!-- 基本信息资料 -->
				<div class="basic_info">
					<div class="basic_info_title">
						基本信息
					</div>
					<div class="basic_info_content">
						<div class="basic_info_content_left_pannel">
							<div class="input_group">
								<div><p><i>*</i>姓名:</p></div>
								<input type="text" name="name" value="${userMap.name}">
								<span id="tishi1"></span>
							</div>
							<div class="input_group">
								<div><p><i>*</i>性别:</p></div>
								<ul>
									<li>
										<input type="radio" style="" name="sex" value="男" <c:if test="${userMap.sex == '男'}">checked</c:if>><span class="fixedWidth ">男</span>
									</li>
									<li>
										<input type="radio" style="" name="sex" value="女" <c:if test="${userMap.sex == '女'}">checked</c:if>><span class="fixedWidth ">女</span>
									</li>
								</ul>
								<span id="tishi2"></span>
							</div>
							<div class="input_group">
								<div><p><i>*</i>户籍地:</p></div>
								<select class="twoclass province" name="residence" id="province1"> 
									<option value="">请选择</option>
							    </select>
							    <select class="twoclass" id="city1"> 
								     <option value="">请选择</option>
							    </select>
							     <span id="tishi3"></span>
							</div>
							<div class="input_group">
								<div><p>居住地:</p></div>
								<select class="twoclass province" name="" id="province2"> 
								     <option value="">请选择</option>
							    </select>
							    <select class="twoclass" id="city2"> 
								      <option value="">请选择</option>
							    </select>
							</div>
							<div class="input_group">
								<div><p><i>*</i>职业:</p></div>
								<input type="text" name="vocation" value="${userMap.vocation}">
								<span id="tishi4"></span>
							</div>
							<div class="input_group">
								<div><p>身份证号码:</p></div>
								<input type="text" name="idcard" value="${userMap.idcard}">
							</div>
							<div class="input_group">
								<div><p><i>*</i>移动电话:</p></div>
								<input type="text" name="mobile_phone" value="${userMap.mobile_phone}" readonly="readonly">
								<span id="tishi5"></span>
							</div>
						</div>
						<div class="basic_info_content_right_pannel">
							<div class="input_group">
								<div id="headimg" style=" border: 1px solid #ccc;">
								<c:if test="${empty url}">
								<img src="<c:url value='/share/images/head.jpg'/>" id="imgUrl" alt="" style="width:150px;max-height:150px"/>
								</c:if>
								<c:if test="${not empty url}">
								<img src="${fileServer}${url}" id="imgUrl" alt="" style="width:148px;max-height:148px"/>
								</c:if>
								<!-- <div id="change_head_btn">修改头像<input  accept="image/*" name="file" type="file" id="fileId"/></div> -->
								
							</div>
							<a href="javascript:;" class="file" id="change_head_btn">修改头像
    							<input  accept="image/png,image/bmp,image/jpeg,image/gif,image/jpg" name="file" type="file" id="fileId"/>
							</a>
							<div class="input_group" style="margin-top: 27px;">
								<div><p><i>*</i>邮箱:</p></div>
								<input type="text" name="email" value="${userMap.email}">
								<span id="tishi6"></span>
							</div>
							<div class="input_group">
								<div><p>固定电话:</p></div>
								<input type="text" name="fixed_phone" value="${userMap.fixed_phone}">
							</div>
							<div class="input_group">
								<div><p>紧急联系电话:</p></div>
								<input type="text" name="emer_phone" value="${userMap.emer_phone}">
							</div>
						</div>
					</div>
				</div>
				<!-- 培训需求资料 -->
				<div class="trainning_needs">
					<div class="trainning_needs_title">
						培训需求
					</div>
					<div class="trainning_needs_content">
							<div class="input_group">
								<div><p><i>*</i>前往国家/地区:</p></div>
								<select id="country_area" name="country_area"  onchange="continent(this.value)"> 
								      <option value="">请选择</option> 
							    </select>
							    <span id="tishi7"></span>
							</div>
							<div class="input_group" style="margin-left: 50%;margin-top: -61px;">
								<div><p>所属区域:</p></div>
								<input type="text" id="area_range" name="area_range" readonly="readonly" value="${userMap.area_range}">
							</div>
							<div class="input_group">
								<div><p><i>*</i>期望学习课程:</p></div>
								<ul id="expect_course">
									
								</ul>
								<span id="tishi8"></span>
							</div>
							<div class="input_group">
								<div><p><i>*</i>出行目的:</p></div>
								<select id="trip_pur"> 
								      <option value="">请选择类型</option> 
								      <option value="旅游" <c:if test="${userMap.trip_pur == '旅游'}">selected</c:if>>旅游</option> 
								      <option value="务工" <c:if test="${userMap.trip_pur == '务工'}">selected</c:if>>务工</option> 
								      <option value="留学" <c:if test="${userMap.trip_pur == '留学'}">selected</c:if>>留学</option> 
								      <option value="科技交流" <c:if test="${userMap.trip_pur == '科技交流'}">selected</c:if>>科技交流</option> 
								      <option value="会议" <c:if test="${userMap.trip_pur == '会议'}">selected</c:if>>会议</option> 
								      <option value="商贸谈判" <c:if test="${userMap.trip_pur == '商贸谈判'}">selected</c:if>>商贸谈判</option> 
							    </select>
							    <span id="tishi9"></span>
							</div>
							<div class="input_group" style="margin-left: 50%;margin-top: -61px;">
								<div><p><i>*</i>出行方式:</p></div>
								<select id="travel_way"> 
								      <option value="">请选择</option> 
								      <option value="自由行" <c:if test="${userMap.trip_way == '自由行'}">selected</c:if>>自由行</option> 
								      <option value="公派" <c:if test="${userMap.trip_way == '公派'}">selected</c:if>>公派</option> 
								      <option value="旅行团" <c:if test="${userMap.trip_way == '旅行团'}">selected</c:if>>旅行团</option> 
							    </select>
							    <span id="tishi10"></span>
							</div>
							<div class="input_group" id="travel_agency" style="display:none;">
								<div><p>旅行社名称:</p></div>
								<input type="text" style="width:700px;" name="travel_name" value="${userMap.travel_name}">
							</div>
							<div class="input_group" id="remark">
								<div style="float:left;"><p style="margin-right: 5px;">备注:</p></div>
								<textarea name="note" id="note" style=" float: left; width: 793px; padding: 5px;margin-left: 6px;" rows="4">${userMap.note}</textarea>
							</div>
					</div>
				</div>
			</div>
			
			<button type="button" class="btn btn-primary" id="save">完成</button>
				
		</div>
		<div class="modal fade bs-example-modal-lg" id="fail" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
			<div class="modal-dialog modal-lg">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
						<h4 class="modal-title" id="myLargeModalLabel">错误</h4>
					</div>
					<div class="modal-body">
						账号或密码错误
					</div>
					<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					</div>
				</div>
			 </div>
	</div>
	</div>
	<script type="text/javascript">
		var userName = '${userName}';
		var actionId = '${id}';
		var actionType = "avatar";
		var rootPath = '${rootPath}';
		var fileServer ='${fileServer}';
		var course = '${userMap.expect_course}';
		var country = '${userMap.country_area}';
		var registry = '${userMap.registry}';
		var residence = '${userMap.residence}';
		registry = registry.split(" ");
		residence = residence.split(" ");
		course = course.split(",");
		$(function(){
			
			//自动适应高度
		
			$("textarea").css("resize","none");


			// 改变出行方式
			$("#travel_way").change(function(){
				console.log($("#travel_way").val());
				if ($("#travel_way").val() == "旅行团") {
					$("#travel_agency").show();
				}else{
					$("#travel_agency").hide();
				}
			});
			
			
			//图片位置
			fixImg();
			$("#imgUrl")[0].onload = function() {
	            console.log("loaded");
	            console.log("heihgt："+ $("#imgUrl").height());
				console.log("width："+ $("#imgUrl").width());
	            fixImg();
	        }
			
			function fixImg(){
				$("#imgUrl")[0].style.marginTop = "0px";
				if($("#imgUrl").height() < 148){
					console.log(1)
					$("#imgUrl")[0].style.marginTop = 75 - $("#imgUrl").height()/2 + "px";
				}
			}


			// 修改头像
			$("#change_head_btn").click(function(){
				$('#fileId').fileupload({
	                dataType: 'html',//数据类型：json
	                url: rootPath + '/attach/upload/file/无/' + actionType + '/' + actionId,//上传地址
	                formData: {name:'file'},
	                add: function (e,data) {
	                    data.submit();
	                },
	                done: function (e,data) {
	                    var param = successDataTransform(data.result);
	                    if(param.isSuccess){
	                    	$("#imgUrl").attr("src",fileServer+param.errorInfo);
	                    }
	                }
	            });
			});
			getCountry();
			getCourse();
			getProvince();
			$(".province").change(function(){
				var city = $(this).next();
				$.ajax({
					url:"<c:url value='/common/city'></c:url>",
					type:"post",
					dataType:"json",
					data:{"name":$(this).val()},
					success:function(json){
						var html="<option value=''>请选择</option>";
						if(json){
							for(var i=0;i<json.length;i++){
								html+="<option value='"+json[i].name+"'>"+json[i].name+"</option>";
							}
						}
						city.html(html);
					}
				});
			});
			
			$("#save").click(function(){
				if(userName){
					submitForm();
				}else{
					$(".modal-body").html("请登录!");
					$("#fail").modal('show');
				}
				
			});
			$(document).keydown(function(event){ 
				if(event.keyCode == 13){ //绑定回车 
					if(userName){
						submitForm();
					}else{
						$(".modal-body").html("请登录!");
						$("#fail").modal('show');
					}
				} 
			}); 

		});
		//获取国家
		function getCountry(){
			$.ajax({
				url:"<c:url value='/common/country'></c:url>",
				type:"post",
				dataType:"json",
				success:function(json){
					var html="<option value=''>请选择</option>";
					if(json){
						for(var i=0;i<json.length;i++){
							if(json[i].zh_name==country){
								html+="<option value='"+json[i].zh_name+"' selected>"+json[i].zh_name+"</option>";
							}else{
								html+="<option value='"+json[i].zh_name+"'>"+json[i].zh_name+"</option>";
							}
						}
					}
					$("#country_area").html(html);
					
				}
			});
		}
		//获取所选国家所属区域
		function continent(name){
			if(name){
				$.ajax({
					url:"<c:url value='/common/continent'></c:url>",
					type:"post",
					dataType:"json",
					data:{"name":name},
					success:function(json){
						$("#area_range").val(json.zh_name);
					},
					complete : function() {
						
					},
					error : function() {
	
					}
				});
			}
		}
		//获取课程分类
		function getCourse(){
			$.ajax({
				url:"<c:url value='/common/class'></c:url>",
				type:"post",
				dataType:"json",
				success:function(json){
					var html="";
					var html1="";
					if(json){
						for(var i=0;i<json.length;i++){
							if(course[i]==json[i].name && course[i]){
								html1="<li><input type='checkbox' checked name='expect_course' value='"+course[i]+"'><span class='fixedWidth '>"+course[i]+"</span></li>";
								html+=html1;
							}else{
								html+="<li><input type='checkbox' name='expect_course' value='"+json[i].name+"'><span class='fixedWidth '>"+json[i].name+"</span></li>";
							}
						}
					}
					$("#expect_course").html(html);
				}
			});
		}
		//获取省份
		function getProvince(){
			$.ajax({
				url:"<c:url value='/common/province'></c:url>",
				type:"post",
				dataType:"json",
				success:function(json){
					var html1="<option value=''>请选择</option>";
					var html2="<option value=''>请选择</option>";
					if(json){
						for(var i=0;i<json.length;i++){
							if(json[i].name==registry[0]){
								html1+="<option value='"+json[i].name+"' selected>"+json[i].name+"</option>";
							}else{
								html1+="<option value='"+json[i].name+"'>"+json[i].name+"</option>";
							}
							if(json[i].name==residence[0]){
								html2+="<option value='"+json[i].name+"' selected>"+json[i].name+"</option>";
							}else{
								html2+="<option value='"+json[i].name+"'>"+json[i].name+"</option>";
							}
						}
					}
					$("#province1").html(html1);
					$("#province2").html(html2);
					console.log(registry);
					if(registry[0]!==""){
						$("#city1").html("<option value='"+registry[1]+"' selected>"+registry[1]+"</option>")
					}
					if(residence[0]!==""){
						$("#city2").html("<option value='"+residence[1]+"' selected>"+residence[1]+"</option>")
					}
				}
			});
		}
		//获取市区
		function getCity(name){
			alert(this.value);
			$.ajax({
				url:"<c:url value='/common/city'></c:url>",
				type:"post",
				dataType:"json",
				data:{"name":name},
				success:function(json){
					var html="<option value=''>请选择</option>";
					if(json){
						for(var i=0;i<json.length;i++){
							html+="<option value='"+json[i].name+"'>"+json[i].name+"</option>";
						}
					}
					$(".province").html(html);
				}
			});
		}
		function prompt(id,info){
			if(info){
				var html = "<font color='red'>*"+info+"</font>";
			}else{
				var html="";
			}
			$("#"+id).html(html);
		}
		function check_form(name,sex,province1,city1,vocation,mobile_phone,email,country_area,expect_course,trip_pur,trip_way){
			var regEmail = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/; 
			var phoneTest = /^1[3,4,5,7,8]\d{9}$/;
			if(name=="" || name==null){
				prompt("tishi1","请填写姓名");
				return false;
			}else{
				prompt("tishi1","");
			}
			if(sex=="" || sex==null){
				prompt("tishi2","请选择性别");
				return false;
			}else{
				prompt("tishi2","");
			}
			if(province1=="" || city1==""){
				prompt("tishi3","请选择户籍地");
				return false;
			}else{
				prompt("tishi3","");
			}
			if(vocation=="" || vocation==null){
				prompt("tishi4","请填写职业");
				return false;
			}else{
				prompt("tishi4","");
			}
			if(!phoneTest.test(mobile_phone)){
				prompt("tishi5","请填正确的手机号");
				return false;
			}else{
				prompt("tishi5","");
			}
			if(!regEmail.test(email)){
				alert(1);
				prompt("tishi6","请填正确的邮箱");
				return false;
			}else{
				prompt("tishi6","");
			}
			if(country_area=="" || country_area==null){
				prompt("tishi7","请选择国家地区");
				return false;
			}else{
				prompt("tishi7","");
			}
			if(expect_course=="" || expect_course==null){
				prompt("tishi8","请选择期望学习的课程");
				return false;
			}else{
				prompt("tishi8","");
			}
			if(trip_pur=="" || trip_pur==null){
				prompt("tishi9","请填写出行目的");
				return false;
			}else{
				prompt("tishi9","");
			}
			if(trip_way=="" || trip_way==null){
				prompt("tishi10","请填写出行方式");
				return false;
			}else{
				prompt("tishi10","");
			}
			return true;
		} 
		function submitForm(){
			var name = $("input[name='name']").val();
			var sex = $("input[name='sex']:checked").val();
			var province1 = $("#province1").val();
			var city1 = $("#city1").val();
			var province2 = $("#province2").val();
			var city2 = $("#city2").val();
			var vocation = $("input[name='vocation']").val();
			var country_area = $("#country_area").val();
			var trip_pur = $("#trip_pur").val();
			var trip_way = $("#travel_way").val();
			var note = $("#note").val();
			var idcard = $("input[name='idcard']").val();
			var mobile_phone = $("input[name='mobile_phone']").val();
			var email = $("input[name='email']").val();
			var fixed_phone = $("input[name='fixed_phone']").val();
			var emer_phone = $("input[name='emer_phone']").val();
			var area_range = $("input[name='area_range']").val();
			var travel_name = $("input[name='travel_name']").val();
			var expect_course="";
			$("input[name='expect_course']:checked").each(function(){ 
				if(expect_course==''){
					expect_course = $(this).val();
				}else{
					expect_course +=","+$(this).val();
				}
			});
			var state = check_form(name,sex,province1,city1,vocation,mobile_phone,email,country_area,expect_course,trip_pur,trip_way);
			if(state){
				var data={"name":name,"sex":sex,"registry":province1+" "+city1,"residence":province2+" "+city2,
						"idcard":idcard,"mobile_phone":mobile_phone,"fixed_phone":fixed_phone,"emer_phone":emer_phone,
						"email":email,"country_area":country_area,"area_range":area_range,"expect_course":expect_course,"trip_pur":trip_pur,
						"trip_way":trip_way,"travel_name":travel_name,"note":note,"vocation":vocation};
				$.ajax({
					url:"<c:url value='/login/save'/>",
					type:"post",
					dataType:"json",
					data:{"data":JSON.stringify(data)},
					success:function(json){
						console.log(json);
						if(json.isSuccess){
							location.href="<c:url value='/'></c:url>";
						}else{
							$(".modal-body").html(json.info);
							$("#fail").modal('show');
							alert(1);
						}
					}
				});
			}
		}

		$(document).ready(function(){
	        $("#dropdownMenu1").mouseover(function(){
	        	$(".dropdown-menu").show();
	        });
	        $(".dropdown-menu").mouseover(function(){
	        	 $(".dropdown-menu").show(); 
	         }).mouseout(function(){
	        	console.log(3)
	            $(".dropdown-menu").hide();
	         }); 
	      })
	      
	      
	      
	      		
			var userName = '${userName}';
			var uuid = '${uuid}';
			var tabId = '${tabId}';
			var rootPath = '${rootPath}';
			if(!tabId){
				tabId = '1';
			}
			
			if (uuid) {
				var socket = new SockJS("/eduPlatform/ws");
				var stompClient = Stomp.over(socket);
				
				// Callback function to be called when stomp client is connected to server
				var connectCallback = function() {
					stompClient.subscribe('/topic/msgfetch/' + uuid, getUnReadMsg);
				};
				// Callback function to be called when stomp client could not connect to server
				var errorCallback = function(error) {
					//alert(error.headers.message);
					alert(error);
				};
				// Connect to server via websocket
				stompClient.connect("guest", "guest", connectCallback, errorCallback);
				
				//getUnReadMsg();
			}

			$(function() {
				$(".home_header-nav li").click(function() {
					$(".home_header-nav li a").removeClass("home_header_1_ClickA");
					//$(this).children().addClass("home_header_1_ClickA");
				});
				//消息信息
				$(".wh_Home_news").hover(function(){
					$(".header-tc-content").show();
				},function(){
					$(".header-tc-content").hide();
				});
				var url = null;
				var liTag = null;
				switch(tabId){
				case '1':
					url = '<c:url value="/study/course" />';
					break;
				case '2':
					url = '<c:url value="/case/study" />';
					break;
				case '3':
					url = '<c:url value="/exam/mv" />';
					break;
				case '4':
					url = '<c:url value="/foreign/study" />';
					break;
				case '5':
					url = '<c:url value="/consultation" />';
					break;
				case '6':
					url = '<c:url value="/msg/0" />';
					break;
				default:
					url = '<c:url value="/study/course" />';
				}
				$('#li'+tabId).children().addClass("home_header_1_ClickA");
				var height = $(this).outerHeight() - 84 + "px";
				$('#contentPan').css('height', height).css('width', '100%').attr(
						'src', url);
				
				$(window).resize(function(){
					$('#contentPan').css('height', height);
				});
			});
			
			function naviClick(id) {
				location.href='<c:url value="/?tabId=" />'+id;
			}
			function _naviClick(id) {
				location.href= rootPath + '?tabId=6';
			}

			//有新的推送，获取未读消息条数并显示
			function getUnReadMsg() {
				var htmlStr = '<audio src="'+rootPath+'/share/voice/remind.m4a" autoplay="autoplay"></audio>';
				$('#alertSound').html(htmlStr);
				init_count();
			}
			
			//消息查看
			function checkMsg(){
				
			}
			
			$("#news-list li").click(function(){
				var DataUrl = $(this).children().children("a").data('url');
				$(".clearfix li a").removeClass("home_header_1_ClickA");
				$("#contentPan").attr("src",DataUrl);
			});
			
			var NewsListHtml;
			var ContentHtml = "";
			var MsgTitle = "";
			var MsgDetailsHtml = "";
			$("#news-list").on("click","li>div>a",function(){
				var id = $(this).data('id');
				//init_count();
				$(".modal-body").html(MsgDetailsHtml);
				$(".modal-body-details").html(ContentHtml);
				$("#myModalLabel").html(MsgTitle);
				init_msg(1);
				if($("#contentPan").attr("src") == "/eduPlatform/msg/0"){
					$("#contentPan").attr("src","/eduPlatform/msg/0");
				}
			})
			init_msg();
			//获取消息推送信息
			function init_msg(type){
				var url = "<c:url value='/msg/list'></c:url>";
				$.ajax({
					url: url,
					type: 'POST',
					dataType: 'html',
					data:{
						"pageSize": 4,
						"uuid": uuid,
						"notRead": true
					},
					success:function(data){
						var obj = gridDataFormat(data);
						console.log(obj);
						var html = "";
						var AlertHtml = "";
						ContentHtml = "";
						MsgTitle = "";
						MsgDetailsHtml = "";
						if(obj.count == 0){
							html += '<li class="news-item clr">'+
						            	'<div class="news-ctx clr" style="text-align: center;">'+
					        				'目前没有新消息'+
					        			'</div>'+
					        		'</li>';
						}
						for(var i in obj.data){
							ContentHtml = obj.data[i].msgCon == null?"无":obj.data[i].msgCon;
							MsgTitle = obj.data[i].msgName == null?"无":obj.data[i].msgName;
							pushTime = obj.data[i].pushTime == null?"无":obj.data[i].pushTime;
							creater = obj.data[i].creater == null?"无":obj.data[i].creater;
							createTime = obj.data[i].createTime == null?"无":obj.data[i].createTime;
							createTime = createTime.substring(0,10) +"&nbsp;"+ createTime.substring(11,16);
							pushReason = obj.data[i].pushReason == null?"无":obj.data[i].pushReason;
						    MsgDetailsHtml = '<div style="width: 195px; float: left;">'+
							       			 	'接收人：'+ MsgTitle +''+
								      		 '</div>'+
								      		 '<div>'+
								      		 	 '推送时间：'+ pushTime +''+
								      		 '</div>'+
								      		 '<div style="width: 195px; float: left;">'+
								      			 '编制人：'+ creater +''+
								      		 '</div>'+
								      		 '<div>'+
								      			 '编制时间：'+ createTime +''+
								      		 '</div>'+
								      		 '<div>'+
								      			 '推送原因： '+ pushReason +''+
								      		 '</div>';
							AlertHtml = obj.data[i].type == "自定义"?'data-toggle="modal" data-target="#myModal" href="javascript:;"':'target="_blank" href="<c:url value="/surveyAnalyze/answerMv/'+ obj.data[i].relatedId +'"></c:url>"';
							html += '<li class="news-item clr" onclick="state_change('+ obj.data[i].id +')">'+
					            		'<div class="news-ctx clr">'+
					        				'<a class="news-ctx-link  blank_to" '+ AlertHtml +' data-id="'+ obj.data[i].id +'" data-url="/eduPlatform/msg/'+ obj.data[i].id +'" data-state="'+ obj.data[i].state +'" title="'+ obj.data[i].type +'—'+ obj.data[i].msgName +'">'+ obj.data[i].type +'—'+ obj.data[i].msgName +'</a>'+
					        				'<div class="news-type news-app11" style="width: 8px;height: 8px;border-radius: 50%;background: #eb3f3f;float: left;margin-top: 25px;margin-left: 15px;"></div>'+
					        			'</div>'+
					        		'</li>';
						}
						NewsListHtml = html;
						$("#news-list").html(html);
						if(type != 1){
							$(".modal-body").html(MsgDetailsHtml);
							$(".modal-body-details").html(ContentHtml);
							$("#myModalLabel").html(MsgTitle);
						}
					},
					error:function(){
						//console.log();
					}
				});
			}
			
			//改变状态
			function state_change(id){
				var url = "<c:url value='/msg/read'></c:url>";
				$.ajax({
					url: url,
					type: 'POST',
					dataType: 'html',
					data:{
						"ids":id
					},
					success:function(data){
						if(data < 1){
							//alert("阅读失败");
							location.reload();
						}
					},
					error:function(){
						//console.log();
					}
				});
			}
			
			init_count();
			//获取未读数
			function init_count(){
				var url = "<c:url value='/msg/count'></c:url>";
				$.ajax({
					url: url,
					type: 'POST',
					dataType: 'JSON',
					data:{
						"uuid": uuid,
						"notRead": true
					},
					success:function(data){
						if(data < 1){
							data = "";
						}else if(data > 9){
							data = "...";
						}
						$("#remindId").html(data);
					},
					error:function(){
						//console.log();
					}
				});
			}
			
		
	</script>
</body>
</html>
